/**
 * \class Assignment.cpp
 *
 *  Created on: 6 apr 2011
 *      Author: ytc0039
 */

#include "Assignment.h"
#include <Interfaces/IExp.h>
#include <AbsSyn/Ident.h>

Assignment::Assignment(Ident* ident, IExp* exp):
m_Ident(ident->clone()),
m_Exp(exp->clone())
{

}

Assignment::~Assignment() {
	delete m_Ident;
	m_Ident = NULL;

	delete m_Exp;
	m_Exp = NULL;

}

std::string Assignment::cmdString() const{
	return "Assignment";
}
void Assignment::accept(IStmtVisitor *v){
	v->VisitAssignment(this);
}
Assignment* Assignment::clone() const {
	return (new Assignment(m_Ident,m_Exp));
}

Ident* Assignment::getIdent() const {
	return (m_Ident->clone());
}

void Assignment::setIdent(const Ident& ident)
{

	delete m_Ident; // release the old!
	m_Ident = ident.clone();


}

IExp* Assignment::getExp() const
{
	return m_Exp->clone();
}

void Assignment::setExp(const IExp& exp)
{

	delete m_Exp;
	m_Exp = exp.clone();

}
